<template>
	<div>
		<el-form ref="form" :model="form" label-width="120px">


<!-- 
			<el-form-item label="序号" prop="id">
				<el-input v-model="form.id"></el-input>
			</el-form-item> -->
			<el-form-item label="姓名" prop="name">
				<el-input v-model="form.name"></el-input>


			
			</el-form-item>
			<el-form-item label="性别" prop="foodieSex">
				<el-input v-model="form.foodieSex"></el-input>
			</el-form-item>
			<el-form-item label="年龄" prop="foodieAge">
				<el-input v-model="form.foodieAge" >
				 </el-input>	
			</el-form-item>
			<el-form-item label="喜好" prop="foodieLike">
				<el-input v-model="form.foodieLike"></el-input>
			</el-form-item>
			<el-form-item label="注意事项" prop="foodieNote">
				<el-input v-model="form.foodieNote"></el-input>
			</el-form-item>
			<el-form-item label="备注" prop="foodieRemarks">
				<el-input v-model="form.foodieRemarks"></el-input>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" plain @click="save">保存数据</el-button>

			</el-form-item>
		</el-form>
	</div>
</template>

<script>
	export default {
		name: 'foodie',
		components: {

		},
		props: [
			'show',
			'editid'
		],
		data() {
			return {
				form: {
					// id: '',
					name: '',
					foodieSex: '',
					foodieAge: '',
					foodieLike: '',
					foodieNote: '',
					foodieRemarks: ''
				},

				foodie: [],
				depts: [],
			}
		},
		created() {
			if (this.editid) {
				this.show = true;
				this.$axios.get(
					'foodie/getById',
					response => {
						this.form = response.obj
						
					}, 
					{id: this.editid })
			}
		},
		methods: {
			save() {
				this.axios.get('/foodie/add', (data) => {
					if (data) {
						this.$emit('update:show', false)
						this.$emit('getData')
					}

				}, this.form, '保存成功');
			},
			update(){
						this.axios.get('/foodie/update', (data) => {
							if (data) {
								this.$emit('update:show', false)
								this.$emit('getData')
							}
						
						}, this.id,this.status,'更新成功');
				}
			
			
			
			},
		



	}
</script>

<style>
</style>